export default {
    state: {
        cartList: []
    },
    getters: {
        getShopNum(state) {
            var sum = 0;
            state.cartList.forEach(i => {
                if (i.isEffective == true) {
                    sum += i.count
                }
            })
            return sum
        },
        getshopchecked(state) {
            var sum = 0;
            state.cartList.forEach(i => {
                if (i.isEffective == true && i.selected == true) {
                    sum += i.count
                }
            })
            return sum
        },
        SumPrice(state) {
            var sum = 0;
            state.cartList.forEach(i=>{
                if (i.isEffective == true) {
                    sum += i.count * i.price * i.selected

                }
            })
            return sum
        }
    },
    mutations: {
        getcart(state, val) {
            state.cartList = val
        }
    }
}